package panelSites;

import info.clearthought.layout.TableLayout;

import java.awt.Color;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class SubjectPanel extends JPanel implements PanelSitesIface {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	// Betreff
	private JLabel betreffLabel = new JLabel("Betreff");
	private JTextArea betreffTextField = new JTextArea(1, 20);
	private JScrollPane betreffscrollpane = new JScrollPane(betreffTextField);

	public SubjectPanel(String text) {
		betreffTextField.setMargin(new Insets(5, 5, 5, 5));
		betreffTextField.setText(text);
		betreffLabel.setBackground(Color.LIGHT_GRAY);
		betreffLabel.setOpaque(true);
		double size[][] = { { 150, TableLayout.FILL }, // Columns
				{ 10, 30, TableLayout.FILL } };// Rows

		TableLayout layout = new TableLayout(size);
		layout.setVGap(5);
		layout.setHGap(5);
		setLayout(layout);
		JPanel fillPanel = new JPanel();
		fillPanel.setBackground(Color.DARK_GRAY);

		// Panel in the top-left corner
		JPanel containsPanel = new ContainsPanel(betreffLabel);

		add(fillPanel, "0,0, 1,0");
		add(containsPanel, "0,1");
		add(betreffscrollpane, "1,1");
		fillPanel = new JPanel();
		fillPanel.setBackground(Color.DARK_GRAY);
		add(fillPanel, "0,2 , 1,2");

	}

	public String getText() {
		return betreffTextField.getText();
	}

	public void setText(String text) {
		betreffTextField.setText(text);
		System.out.println("Betreff gesetzt : " + text);
	}

}
